package chaoyue.study.generics;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 泛型类
 * 只要在类名后跟上泛型参数即可
 */
@Data
@AllArgsConstructor
public class GenericsClass<U, V> {
    private U param1;
    private V param2;

    public static void main(String[] args) {
        // 泛型类在创建时需要显式指明具体的类型
        GenericsClass<String, Integer> g1 = new GenericsClass<>("chaoyue", 233);
        System.out.println(g1);
        GenericsClass<Boolean, Character> g2 = new GenericsClass<>(true, 'c');
        System.out.println(g2);
    }
}
